﻿@{
    ViewBag.Title = Local("ThreadsView.PageTitle");
}
@model IEnumerable<Thread>

@if(Model!=null)
{
<div class="box tright">
    <button onclick="location.href='@CUrls.ThreadView'; return false;"> @GLocal("Thread.New") </button>
</div>
@CPHelper.ShowPager(ViewBag.Pages, PageIndex, CUrls.ThreadsView, new Func<int,string>(CUrls.GetThreadsView))
<div class="box">
    <table cellpadding="0" cellspacing="0">
        <thead>
            <tr>
                <td>@GLocal("Thread.Title")</td>
                <td>@GLocal("Thread.CategoryID")</td>
                <td>@GLocal("Thread.Key")</td>
                <td class="w160">@GLocal("Thread.LastModified")</td>
                <td>@GLocal("Thread.IsApproved")</td>
            </tr>
        </thead>
        <tbody>
        @foreach (var thread in Model)
        { 
            <tr>
                <td title="@GLocal("Thread.Summary")：@thread.Summary.Truncate(30, "...")
@GLocal("Thread.CreateDate")：@thread.CreateDate.ToLocalDateTimeString()">@thread.Title
                    <div class="action-panel">
                        <a href="@CUrls.ThreadView?id=@thread.ThreadID">@GLocal("Thread.Edit")</a> 
                        @Html.AjaxLink(HttpAction.Delete, "Thread.Delete", new{did = thread.ThreadID})
                    </div>
                </td>
                <td title="@thread.Category.Description">@thread.Category.CategoryName</td>
                <td>@thread.Key</td>
                <td class="w160">@thread.LastModify.ToLocalDateTimeString()</td>
                <td>@CPHelper.ShowBoolean(thread.IsApproved)</td>
            </tr>
        }
        </tbody>
    </table>
</div>
@CPHelper.ShowPager(ViewBag.Pages, PageIndex, CUrls.ThreadsView, new Func<int,string>(CUrls.GetThreadsView))
}
